#include <stdio.h>
#include <iostream>
#include"../base.h"
using namespace std;
typedef struct {
	int i;
	int j;
	int k;
	int value;
} threeGroup;
void findMin(int A[], int n1, int B[], int n2, int C[], int n3) {
	threeGroup tg;
	tg.value = INT_MAX;
	int temp = 0;
	for (int i = 0; i < n1; i++)
	{
		for (int j = 0; j < n2; j++) {
			for (int k = 0; k < n3; k++)
			{
				temp = abs(A[i] - B[j]) + abs(C[k] - B[j]) + abs(A[i] - C[k]);
				if (tg.value>temp)
				{
					tg.i = A[i];
					tg.j = B[j];
					tg.k = C[k];
					tg.value = temp;
				}
			}
		}
	}
	cout << tg.i << " " << tg.j << " " << tg.k << " " << tg.value << " ";
}
int main() {
	int A[] = { 3,4,5,2 };
	int B[] = { 2,7,5,6 };
	int C[] = { 10,23,4,6 };

	findMin(A,4, B,4, C,4);
	return -1;
}